/*
*
* Copyright (C) 2004 - 2008 BitLaboratory (see http://www.bitlaboratory.com)
* All rights reserved. 
*
* Redistribution and use in source and binary forms, with or without modification, 
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
*    this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
*    this list of conditions and the following disclaimer in the documentation
*    and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
*    derived from this software without specific prior written permission. 
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
* OF SUCH DAMAGE.
*
* You can find the latest version of this library at http://www.bitlaboratory.com
*
*/


using System;
using System.Drawing;
using System.Runtime.InteropServices;

namespace BitLaboratory.Win32Api.Themes
{
	[StructLayout(LayoutKind.Sequential)]
#if( _SHARED_ )
	internal struct DTBGOPTS
#else
	public struct DTBGOPTS
#endif
	{
		public static readonly int SizeOf = Marshal.SizeOf(typeof(DTBGOPTS));
		
		public int dwSize;
		public DrawThemeBackgroundFlags dwFlags;
		public RECT rcClip;
	}

	
	[StructLayout(LayoutKind.Sequential)]
#if( _SHARED_ )
	internal struct INTLIST 
#else
	public struct INTLIST 
#endif
	{
		public static int MAX_INTLIST_COUNT = 10;
		
		public int iValueCount;
		public int[] iValues;
	}

	[StructLayout(LayoutKind.Sequential)]
#if( _SHARED_ )
	internal struct MARGINS 
#else
	public struct MARGINS 
#endif
	{
		int cxLeftWidth;
		int cxRightWidth;
		int cyTopHeight;
		int cyBottomHeight;
	}

	[StructLayout(LayoutKind.Sequential)]
#if( _SHARED_ )
	internal class COMRECT
#else
	public class COMRECT
#endif
	{
		public int bottom;
		public int left;
		public int right;
		public int top;

		public COMRECT()
		{ 
		}

		public COMRECT(Rectangle r)
		{
			this.left = r.X;
			this.top = r.Y;
			this.right = r.Right;
			this.bottom = r.Bottom;
		}

		public COMRECT(RECT rect)
		{
			this.left = rect.left;
			this.top = rect.top;
			this.bottom = rect.bottom;
			this.right = rect.right;
		}

		public COMRECT(int left, int top, int right, int bottom)
		{
			this.left = left;
			this.top = top;
			this.right = right;
			this.bottom = bottom;
		}

		public void CopyTo(COMRECT destRect)
		{
			destRect.left = this.left;
			destRect.right = this.right;
			destRect.top = this.top;
			destRect.bottom = this.bottom;
		}

		public static COMRECT FromXYWH(int x, int y, int width, int height)
		{
			return new COMRECT(x, y, (x + width), (y + height));
		}

		public RECT ToRECT()
		{
			return new RECT(this.left, this.top, this.right, this.bottom);
		}

		public override string ToString()
		{
			object[] objArray = new object[8];

			objArray[0] = "Left = ";
			objArray[1] = this.left;
			objArray[2] = " Top ";
			objArray[3] = this.top;
			objArray[4] = " Right = ";
			objArray[5] = this.right;
			objArray[6] = " Bottom = ";
			objArray[7] = this.bottom;

			return String.Format("[{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}]", objArray);
		}
	}

}
